<template>
  <div style="overflow: hidden" :class="otherStyle==true?'':'margin-left'">
    <div :class="[otherStyle==true?'small-item':'small-item-other',(index+1)%5==0?'small-item-five':'small-item-original']" v-for="(item,index) in list" :key="index">
      <div :class="otherStyle==true?'soon-dianzan':'soon-dianzan-other'" @mouseenter="watchlater=index" @mouseleave="watchlater=-1">
        <img class="common-cursor soon-dianzan-img" :src="require('/src/assets/img/picture.png')" alt="">
        <span class="length" v-show="watchlater!=index">00:08</span>
        <span class="i-watchlater" v-show="watchlater==index"></span>
        <div class="be-tags-container">
          <div class="tag new-tag">
          NEW
          </div>
        </div>
      </div>
      <div class="video-title">
        <span class="two-text-overflow common-cursor common-hover">{{item.title}}</span>
      </div>
      <div class="meta">
        <div style="width: 92px;display: inline-block">
          <span class="iconfont icon-bofang"></span>
          <span style="margin-left: 5px" class="play">{{item.views}}</span>
        </div>
        <span class="iconfont icon-xinxi" v-if="otherStyle"></span>
        <span style="margin-left: 5px">{{item.date}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  /**视频盒子 块分布**/
  name: "initialVideoItem",
  props: {
    list: {
      type: Array,
      default: ()=>[]
    },
    otherStyle:{
      type:Boolean,
      default: true
    }
  },
  data(){
    return{
      watchlater:-1,
    }
  }
}
</script>

<style scoped>
.margin-left{
  margin-left: -10px;
}

.small-item {
  display: block;
  float: left;
  width: 170px;
  position: relative;
  margin-bottom: 3px;
  /*padding: 10px 10px 10px 0;*/
}
.small-item-original{
  padding: 10px 10px 10px 0;
  margin-right: 7px;
}
.small-item-five{
  padding: 10px 0 10px 0;
}
.small-item-other {
  display: block;
  float: left;
  width: 208px;
  position: relative;
  margin: 0 0 3px;
  padding: 10px;
}
.meta{
  font-size: 12px;color: #999999
}
.soon-dianzan{
  width: 160px;height: 100px;position: relative;border-radius: 4px;overflow:hidden;
}
.soon-dianzan-other{
  width: 188px;height: 119px;position: relative;border-radius: 4px;overflow:hidden;
}
.soon-dianzan-img{
  width: 100%;height: 100%;object-fit: cover;
}
.length {
  font-size: 12px;
  z-index: 5;
  right: 4px;
  bottom: 6px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  line-height: 20px;
  padding: 0 6px;
  position: absolute;
}
.video-title{
  margin-top: 4px;height: 40px;font-size: 12px;line-height: 20px;overflow: hidden;
}
.two-text-overflow{
  max-height: 40px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  word-break: break-word;
  -webkit-line-clamp: 2;
}
.common-cursor{
  cursor: pointer;
}
.common-hover:hover {
  color: #00a1d6;
}
.be-tags-container {
  display: flex;
  align-items: center;
  position: absolute;
  top: 4px;
  right: 4px;
}
.tag.new-tag {
  background-color: #42a0c4;
}

.be-tags-container .tag {
  align-items: center;
  padding: 1px 3px;
  font-size: 10px;
  color: #fff;
  text-align: center;
  border-radius: 2px;
  margin-left: 4px;
  white-space: nowrap;
}
.i-watchlater {
  position: absolute;
  right: 6px;
  bottom: 4px;
  width: 22px;
  height: 22px;
  z-index: 5;
  border-radius: 4px;
  background: url(https://images.weserv.nl/?url=https://i0.hdslb.com/bfs/static/jinkela/space/asserts/watchlater-1.svg) rgba(33,33,33,.8) 50%/contain no-repeat;
  cursor: pointer;
}
</style>
